﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IntellectShop.Web2.ViewModels.ScheduleNearestViewModel>" %>

<%@ Import Namespace="IntellectShop.Web2.Code" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%= Html.Resource("Title") %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h1>
		<%= Html.Resource("Title") %>
	</h1>
	<div class="innerArticle">
		<% Html.RenderAction("ViewBody", "PageContent", new { pageContentUniqName = IntellectShop.Common.PageContentUniqName.ScheduleIndex }); %>
	</div>

	<table class="hovered">
		<% foreach (var category in Model.NearestGroupedCourses.Keys)%>
		<% { %>
			<tr>
				<th colspan="2" style="font-size: 12px; text-align: left;">
					<%= Html.Resource("CategoryTitle")%>:
					<%=
						Html.ActionLink(
						category.Name, "Browse", "Course",
						new { CategoryID = category.CategoryID },
						new { style = "font-weight: bold;background-color: transparent; color: #ffffff;" })%>
				</th>
				<% for (int i = 0; i < IntellectShop.Common.Schedule.MonthOfNearestCourses; i++) %>
				<% { %>
				<th>
					<%= Html.Encode(Model.BaseDate.AddMonths(i).ToString("MMMM")) %>
				</th>
				<% } %>
			</tr>
			<% foreach (var tag in Model.NearestGroupedCourses[category].Keys) %>
			<% { %>
				<% if (!String.IsNullOrEmpty(tag) || Model.NearestGroupedCourses[category].Keys.Count > 1) %>
				<% { %>
				<tr>
					<td class="subheader" colspan="<%= IntellectShop.Common.Schedule.MonthOfNearestCourses + 2 %>">
						<p style="font-size: 9px;">
							<% IntellectShop.Common.TagsSet set = IntellectShop.Common.TagsSet.GetFavoritesTags(Model.NearestGroupedCourses[category][tag]); %>
							<% for (int i = 0; i < set.Count; i++) %>
							<% {%>
								<span style="margin-left: 6px;margin-right: 0px;">
									<%= Html.ActionLink(Html.Encode(set[i]), "Browse", "Tags", new { tag = set[i] }, null)%>
								</span>
								<% if (i < set.Count - 1) %>
								<% { %>
								,
								<% } %>
							<% } %>
						</p>
					</td>
				</tr>
				<% } %>
				<% foreach (var course in Model.NearestGroupedCourses[category][tag] ) %>
				<% { %>
				<tr class="clickable" onclick='javascript: document.location.href = $("td a", $(this)).attr("href"); return false;'>
					<td style="text-align: right; white-space:nowrap;">
						<%= Html.ActionLink(
						course.Code,
						"Details", "Course",
						new { id = course.CommodityID }, null) %>
					</td>
					<td>
						<%= course.Name %>
					</td>
					<% for (int i = 0; i < IntellectShop.Common.Schedule.MonthOfNearestCourses; i++)%>
					<% { %>
					<td>
						<div class="sheduleDates">
							<%= course.Schedule.GetScheduleItemInMonth(Model.BaseDate.AddMonths(i))%>
						</div>
					</td>
					<% } %>
				</tr>
				<% } %>
			<% } %>
		<% } %>
	</table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Price" runat="server">
	<div class="sidebaritem">
		<h1>
			<%= Html.Resource("Strings, Download")%></h1>
		<%= Html.ActionLink(Html.Resource("Strings, DownloadPriceList"), "DownloadPriceList", "File")%>
	</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="SecondInfo" runat="server">
	<div class="sidebaritem">
		<% Html.RenderPartial("SubmenuStore"); %>
	</div>
</asp:Content>
